
<form id="add-form" class="form-horizontal col-sm-12" role="form" data-toggle="validator" method="POST" action="">
	{:token()}
	<input type="hidden" name="row[workorder_type]" value="{$workorder_type}">
	<div class="form-group">
		<div class="col-xs-12 col-sm-6">
			<div class="form-group col-sm-10">
				<label for="c-workorder_number">工单编号:</label>
				<input id="c-workorder_number" data-rule="required" class="form-control" placeholder="工单编号" name="row[workorder_number]" value="{$number}" type="text">
			</div>
		</div>
		<div class="col-xs-12 col-sm-6">
			<div class="form-group col-sm-10">
				<label for="c-title">工单标题:</label>
				<input id="c-title" data-rule="required" class="form-control" placeholder="工单标题" name="row[title]" type="text">
			</div>
		</div>

		<div class="col-xs-12 col-sm-6">
			<div class="form-group col-sm-10">
				<label >关联客户:</label>
				<input type="hidden" name="row[customer_id]" data-rule="required" value="" >
				<div class="form-control">
					<a href="javascript:void(0)" class="select-customer" data-name="row[customer_id]"
					   data-url="qingdongams/customer/customer/index?isselect=1"  >【请点击选择】</a>
				</div>
			</div>
		</div>
		<div class="col-xs-12 col-sm-6">
			<div class="form-group col-sm-10">
				<label>客户联系人: </label>
				<input type="hidden" name="row[contacts_id]" data-rule="required"  value="" >
				<div class="form-control">
					<a href="javascript:void(0)" class="select-contacts" data-name="row[contacts_id]"
					   data-url="qingdongams/customer/contacts/index?isselect=1"  >【请点击选择】</a>
				</div>
			</div>
		</div>

		<div class="col-xs-12 col-sm-10">
			<div class="form-group col-sm-10">
				<label for="c-address">所属地区:</label>
				<div class='control-relative'>
					<input id="c-address" class="form-control" data-toggle="city-picker" name="row[address]" type="text" value="" placeholder="请选择所属地区" />
				</div>
			</div>
		</div>
		<div class="col-xs-12 col-sm-6">
			<div class="form-group col-sm-10">
				<label>详细地址:</label>
				<textarea class="form-control" rows="3" name="row[address_detail]" placeholder="详细地址"></textarea>
			</div>
		</div>

		<table class="table table-responsive fieldlist" data-name="row[product]" data-template="testtpl2" data-tag="tr">
			<tr>
				<td>产品名称</td>
				<td>产品数量</td>
				<td>备注</td>
				<td></td>
			</tr>
			<tr>
				<td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></td>
			</tr>
			<textarea name="row[product]" class="form-control hide" cols="30" rows="5">[]</textarea>
		</table>
		<div class="col-xs-12 col-sm-6">
			<div class="form-group col-sm-10">
				<label for="c-name">预约时间:</label>
				<input id="c-name" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" placeholder="预约时间" name="row[appointment_time]" type="text">
			</div>
		</div>
		<div class="col-xs-12 col-sm-10">
			<div class="form-group col-sm-10">
					<label>情况说明:</label>
				<textarea class="form-control" rows="3" name="row[desc]" placeholder="情况说明"></textarea>
			</div>
		</div>
		<div class="col-xs-12 col-sm-10">
			<div class="form-group col-sm-10">
				<label>附件:</label>
				<div class="input-group">
					<input id="c-files" class="form-control" placeholder="请上传附件" size="50" name="row[files]" type="text" value="">
					<div class="input-group-addon no-border no-padding">
                        <span><button type="button" id="plupload-avatar" class="btn btn-danger plupload"
									  data-input-id="c-files"
									  data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
									  data-multiple="false" data-preview-id="p-collection_img"
									  data-url="qingdongams/base/upload"><i class="fa fa-upload"></i> 上传</button></span>

					</div>
					<span class="msg-box n-right" for="c-files"></span>
				</div>
				<ul class="row list-inline plupload-preview" id="p-collection_img"></ul>
			</div>
		</div>

		<div class="col-xs-12 col-sm-6">
			<div class="form-group col-sm-10">
				<label>指派员工:</label>
				<input id="c-owner_staff_id" data-rule="required" class="form-control selectpage" name="row[owner_staff_id]" placeholder="请选择员工"
					   data-source="qingdongams/common/getStaff" type="text" value="">
			</div>
		</div>
	</div>

	<div class="form-group layer-footer">
		<label class="control-label col-xs-12 col-sm-2"></label>
		<div class="col-xs-12 col-sm-8">
			<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
			<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
		</div>
	</div>
</form>

<!--定义模板，模板语法使用Art-Template模板语法-->
<script type="text/html" id="testtpl2">
	<tr class="form-inline">
		<td>
			<input type="hidden" name="row[<%=name%>][<%=index%>][product_id]" value="<%=row['product_id']%>" >
			<div class="form-control" style="width: 90%">

				<a href="javascript:void(0)" class="select-parts"
				   data-name="row[<%=name%>][<%=index%>][product_id]"
				   data-url="qingdongams/product/product/index?isselect=1"  >
					【请点击选择】
				</a>

			</div></td>
		<td style="width: 80px">
			<input type="number" name="row[<%=name%>][<%=index%>][number]" style="width: 80px"
				   class="form-control number" value="<% if(row['number']){%><%=row['number']%><% }else{%>1<% }%>" ></td>

		<td style="width:200px;"><input type="text"  class="form-control  " placeholder="备注" name="row[<%=name%>][<%=index%>][desc]"
										value="<%=row['desc']%>"/></td>

		<td style="width: 120px"><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></td>
	</tr>
</script>
